﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace park.ModelCode
{
    public partial class ModelCodeList : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.Params["m"] != null)
            {
                Response.ContentType = "application/json";
                string m = Request.Params["m"].ToLower();
                string r = "{}";
                switch (m)
                {
                    case "search":
                        r = GetInfo();
                        break;

                }
                Response.Write(r);
                Response.End();
            }
        }


        string fix(string key)
        {
            if (Request.Params[key] != null)
            {
                try
                {
                    return Uri.UnescapeDataString(Request.Params[key]);
                }
                catch
                {
                    return Request.Params[key];
                }
            }
            return "";
        }


        string GetInfo()
        {
            #region 正式代码

            //cn.linkit.epark.ServiceList sl = new cn.linkit.epark.ServiceList();

            //string json = sl.GetModelTypeList();

            //return json;
            #endregion

            #region 测试代码
            string result = ""
                + "[{"
                + "\"ID\": \"MB\","
                + "\"ModeName\": \"咪表\","
                + "\"AddUser\": \"张三\","
                + "\"AddDate\": \"2012-8-20 22:22:30\""
                + "},"
                + "{"
                + "\"ID\": \"ZJQ\","
                + "\"ModeName\": \"中继器\","
                + "\"AddUser\": \"张三\","
                + "\"AddDate\": \"2012-8-20 22:22:30\""
                + "}]";
            string json = string.Empty;

            json = "{\"ModelTypeList\":" + result + "}";

            return json;
            //测试代码---------------------------
            #endregion
        }

    }
}